package com.company;

import java.io.Serializable;

public class Student implements Serializable {              //序列化的对象必须实现Serializable接口，此接口没有任何方法，只是声明接口
    private String name;
    private int age;
    private int stNum;
    transient private int i;        //transient修饰的属性不会序列化，序列化的过程中为默认值

    public Student(String name, int age, int stNum) {
        this.name = name;
        this.age = age;
        this.stNum = stNum;
    }

    @Override
    public String toString() {
        return "年龄:" + name + "\t年龄:" + age + "\t学号:" + stNum + "\ti:" + i;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
